package com.ibm.cps.sql;

import java.util.Set;

import com.ibm.cps.sql.window.WindowDescriptor;

public class AggregationDescriptor {
	private final WindowDescriptor window;
	private final Set<String> aggregationKeyFields;
	
	public AggregationDescriptor(WindowDescriptor window,
			Set<String> aggregationKeyFields) {
		this.window = window;
		this.aggregationKeyFields = aggregationKeyFields;
	}
	
	public WindowDescriptor getWindow() {
		return window;
	}

	public Set<String> getAggregationKeyFields() {
		return aggregationKeyFields;
	}
	
	public void updateAggregationKeyFields(String shortName, String fullName){
		aggregationKeyFields.remove(shortName);
		aggregationKeyFields.add(fullName);
	}

	@Override
	public String toString() {
		return "{\"AggregationDescriptor\":{\"window\":\"" + window
				+ "\", \"aggregationKeyFields\":\"" + aggregationKeyFields
				+ "\"}}";
	}

	public static enum WindowType{
		TIME, COUNT
	}
	
}
